﻿#pragma once

#include "../Shared/Functions/IniReader.h"
#include <string>
#include <vector>
#include "../stringhelper.h"
#include "../tangible_filesystem.h"

namespace AutoPatcher
{
    class InIReader
    {
        #pragma region Fields
    private:
//C# TO C++ CONVERTER WARNING: C++ has no equivalent to a 'readonly' collection which allows modification of internal state:
//ORIGINAL LINE: private readonly List<string> _contents;
        std::vector<std::string> _contents;
        const std::string _fileName;
        #pragma endregion

        #pragma region Constructor
    public:
        InIReader(const std::string &fileName);
        #pragma endregion

        #pragma region Functions
    private:
        std::string FindValue(const std::string &section, const std::string &key);

        int FindIndex(const std::string &section, const std::string &key);

    public:
        void Save();
        #pragma endregion

        #pragma region Read
        bool ReadBoolean(const std::string &section, const std::string &key, bool Default);

        unsigned char ReadByte(const std::string &section, const std::string &key, unsigned char Default);

        signed char ReadSByte(const std::string &section, const std::string &key, signed char Default);

        unsigned short ReadUInt16(const std::string &section, const std::string &key, unsigned short Default);

        short ReadInt16(const std::string &section, const std::string &key, short Default);

        unsigned int ReadUInt32(const std::string &section, const std::string &key, unsigned int Default);

        int ReadInt32(const std::string &section, const std::string &key, int Default);

        unsigned long long ReadUInt64(const std::string &section, const std::string &key, unsigned long long Default);

        long long ReadInt64(const std::string &section, const std::string &key, long long Default);

        float ReadSingle(const std::string &section, const std::string &key, float Default);

        double ReadDouble(const std::string &section, const std::string &key, double Default);

        Decimal ReadDecimal(const std::string &section, const std::string &key, Decimal Default);

        std::string ReadString(const std::string &section, const std::string &key, const std::string &Default);

        char ReadChar(const std::string &section, const std::string &key, char Default);

        Point *ReadPoint(const std::string &section, const std::string &key, Point *Default);

        Size *ReadSize(const std::string &section, const std::string &key, Size *Default);

        TimeSpan ReadTimeSpan(const std::string &section, const std::string &key, TimeSpan Default);
        #pragma endregion

        #pragma region Write
        void Write(const std::string &section, const std::string &key, bool value);

        void Write(const std::string &section, const std::string &key, unsigned char value);

        void Write(const std::string &section, const std::string &key, signed char value);

        void Write(const std::string &section, const std::string &key, unsigned short value);

        void Write(const std::string &section, const std::string &key, short value);

        void Write(const std::string &section, const std::string &key, unsigned int value);

        void Write(const std::string &section, const std::string &key, int value);

        void Write(const std::string &section, const std::string &key, unsigned long long value);

        void Write(const std::string &section, const std::string &key, long long value);

        void Write(const std::string &section, const std::string &key, float value);

        void Write(const std::string &section, const std::string &key, double value);

        void Write(const std::string &section, const std::string &key, Decimal value);

        void Write(const std::string &section, const std::string &key, const std::string &value);

        void Write(const std::string &section, const std::string &key, char value);

        void Write(const std::string &section, const std::string &key, Point *value);

        void Write(const std::string &section, const std::string &key, Size *value);

        void Write(const std::string &section, const std::string &key, TimeSpan value);
        #pragma endregion
    };
}
